package com.lepu.app.main.fragment;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONObject;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.LinearLayout.LayoutParams;

import com.app.config.AppConfig;
import com.app.config.UserConfig;
import com.app.utils.Const;
import com.app.utils.LoginUtil;
import com.app.utils.MyStoreUtil;
import com.app.utils.ObserverConst;
import com.app.utils.Setting;
import com.app.utils.UmengEvent;
import com.app.utils.Utils;
import com.core.lib.application.BaseFragment;
import com.core.lib.core.ApiClient;
import com.core.lib.core.AsyncRequest;
import com.core.lib.utils.Observer;
import com.core.lib.utils.ObserverManager;
import com.core.lib.utils.main.AppManager;
import com.core.lib.utils.main.DateUtilBase;
import com.core.lib.utils.main.UmengHelper;
import com.core.lib.utils.main.UtilityBase;
import com.lepu.app.fun.chat.bean.ChatSession;
import com.lepu.app.fun.chat.core.ChatManager;
import com.lepu.app.fun.index.activity.IndexBaikeActivity;
import com.lepu.app.fun.index.activity.IndexBookActivity;
import com.lepu.app.fun.index.activity.IndexConsultActivity;
import com.lepu.app.fun.index.activity.IndexFileActivity;
import com.lepu.app.fun.index.activity.IndexKnowActivity;
import com.lepu.app.fun.index.activity.IndexRemindActivity;
import com.lepu.app.fun.index.activity.IndexVideoActivity;
import com.lepu.app.fun.index.bean.BeanIndex;
import com.lepu.app.fun.index.bean.BeanIndexNew;
import com.lepu.app.fun.my.MyConsultActivity;
import com.lepu.app.fun.my.adapter.AdapterMyArticle;
import com.lepu.app.fun.my.adapter.AdapterQuestionList;
import com.lepu.app.fun.my.bean.BeanMyArticle;
import com.lepu.app.fun.my.bean.BeanQuestionAnswer;
import com.lepu.app.main.activity.MainTabActivity;
import com.lepu.app.main.bean.BeanFocus;
import com.lepu.app.widget.FocusView;
import com.lepu.app.widget.ListViewForScrollview;
import com.lepu.pasm.R;

@SuppressLint("InflateParams")
public class MainTabFragmentIndex extends BaseFragment implements AsyncRequest,
		Observer,OnRefreshListener {

	private static final String REQUEST_DATA = "request_data";
	private static final String REQUEST_POINT = "request_point";

	private static final int MSG_DATA_SUCCESS = 10;
	private static final int MSG_DATA_FAIL = 11;
	private static final int MSG_POINT_SUCCESS = 12;
	private static final int MSG_POINT_FAIL = 13;

	private View mMainView = null;
	private boolean mInitDataSuccess = false;// 是否加载完数据

	private FocusView mFocusViewTop = null; // 顶部轮播图
	private FocusView mFocusViewMall = null; // 商场轮播图
	private LinearLayout mFocusLayout = null;
	private LinearLayout mMallLayout = null;

	private ListViewForScrollview mListViewHelp;
	private ListViewForScrollview mListViewMake;

	private ImageView mVideoPoint;
	private ImageView mBaikePoint;

	private BeanIndexNew mBeanIndexNew;
	
	private SwipeRefreshLayout mRefreshLayout = null;

	private ArrayList<BeanQuestionAnswer> mQuestionList = null;
	private AdapterQuestionList mQuestionAdapter = null;

	ArrayList<BeanMyArticle> mArticleList = null;
	AdapterMyArticle mArticleAdapter = null;
	
	ImageView indexChatCircleImageView;

	private View mHeadView = null;
	private View mFooterView = null;

	public boolean mRefreshFlag = true;
	
	@SuppressLint("InflateParams")
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		mMainView = LayoutInflater.from(getActivity()).inflate(
				R.layout.main_tab_fragment_index, null, false);
		init();
	}

	@Override
	public void onResume() {
		super.onResume();

		if (mFocusViewTop != null) {
			mFocusViewTop.onResumeViewPager();
		}
		if (mFocusViewMall != null) {
			mFocusViewMall.onResumeViewPager();
		}

		UmengHelper.OnPageStart(UmengEvent.page_shouye);

		// 快速咨询监听
		ObserverManager.getInstance().addObserver(ObserverConst.NOTIFY_CHAT_INDEX_CIRCLE, this);
		//更新红点
		showHideChatCircle();
		
		//视频文章点
		requesNews();
	}

	@Override
	public void onPause() {
		super.onPause();

		if (mFocusViewTop != null) {
			mFocusViewTop.onPauseViewPager();
		}
		if (mFocusViewMall != null) {
			mFocusViewMall.onPauseViewPager();
		}
		UmengHelper.OnPageEnd(UmengEvent.page_shouye);

		// 快速咨询红点
		ObserverManager.getInstance().removeObserver(
				ObserverConst.NOTIFY_CHAT_INDEX_CIRCLE);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		super.onCreateView(inflater, container, savedInstanceState);

		ViewGroup p = (ViewGroup) mMainView.getParent();
		if (p != null) {
			p.removeAllViewsInLayout();
		}
		return mMainView;
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
		mInitDataSuccess = false;

		ObserverManager.getInstance().removeObserver(this);
	}

	@Override
	public void setUserVisibleHint(boolean isVisibleToUser) {
		super.setUserVisibleHint(isVisibleToUser);

		if (isVisibleToUser) {
			if (!mInitDataSuccess || mRefreshFlag) {
				// 第一次进入页面获取数据
				mRefreshFlag = false;
				mHandler.postDelayed(new Runnable() {

					@Override
					public void run() {
						mRefreshLayout.setRefreshing(true);  //直接调用是没有用的
					}
				}, 100);
				request();
			}
		}
	}

	@SuppressWarnings("deprecation")
	private void init() {

		//5.0以下关闭硬件加速
		Utils.setLayerTypeOff(mMainView);
		
		mRefreshLayout = (SwipeRefreshLayout) mMainView.findViewById(R.id.swipeLayout);
		mRefreshLayout.setOnRefreshListener(this);
		mRefreshLayout.setColorScheme(R.color.color_listview_refresh_1,
				R.color.color_listview_refresh_2,
				R.color.color_listview_refresh_3,
				R.color.color_listview_refresh_4);
		mListViewMake = (ListViewForScrollview) mMainView.findViewById(R.id.index_make_listview);
		
		
		mHeadView = LayoutInflater.from(getActivity()).inflate(R.layout.main_tab_fragment_index_head, null);
		mFooterView = LayoutInflater.from(getActivity()).inflate(R.layout.main_tab_fragment_index_footer, null);
		
		mFocusLayout = (LinearLayout) mHeadView.findViewById(R.id.index_focus_layout);
		mListViewHelp = (ListViewForScrollview) mHeadView.findViewById(R.id.index_help_listview);
		LinearLayout consultLayout = (LinearLayout) mHeadView.findViewById(R.id.index_help_consult_layout);
		LinearLayout fileLayout = (LinearLayout) mHeadView.findViewById(R.id.index_help_file_layout);
		LinearLayout remindLayout = (LinearLayout) mHeadView.findViewById(R.id.index_help_remind_layout);
		LinearLayout videoLayout = (LinearLayout) mHeadView.findViewById(R.id.index_make_video_layout);
		LinearLayout knowLayout = (LinearLayout) mHeadView.findViewById(R.id.index_make_know_layout);
		LinearLayout baikeLayout = (LinearLayout) mHeadView.findViewById(R.id.index_make_baike_layout);
		LinearLayout bookLayout = (LinearLayout) mHeadView.findViewById(R.id.index_make_book_layout);

		TextView helpMoreText = (TextView) mHeadView.findViewById(R.id.index_help_list_more);
		TextView makeMoreText = (TextView) mFooterView.findViewById(R.id.index_make_list_more);
		mMallLayout = (LinearLayout) mHeadView.findViewById(R.id.index_mall_layout);
		mVideoPoint = (ImageView) mHeadView.findViewById(R.id.index_make_video_point);
		mBaikePoint = (ImageView) mHeadView.findViewById(R.id.index_make_baike_point);
		
		indexChatCircleImageView  = (ImageView) mHeadView.findViewById(R.id.indexChatCircleImageView);

		consultLayout.setOnClickListener(mOnClickListener);
		fileLayout.setOnClickListener(mOnClickListener);
		remindLayout.setOnClickListener(mOnClickListener);
		videoLayout.setOnClickListener(mOnClickListener);
		knowLayout.setOnClickListener(mOnClickListener);
		baikeLayout.setOnClickListener(mOnClickListener);
		bookLayout.setOnClickListener(mOnClickListener);
		helpMoreText.setOnClickListener(mOnClickListener);
		makeMoreText.setOnClickListener(mOnClickListener);
		mMallLayout.setOnClickListener(mOnClickListener);

		// 问题更新
		ObserverManager.getInstance().addObserver(
				ObserverConst.NOTIFY_INDEX_UPDATE_QUESTION, this);

		// 文章更新
		ObserverManager.getInstance().addObserver(
				ObserverConst.NOTIFY_INDEX_UPDATE_ARTICLE, this);

		showHideChatCircle();
		
		mArticleList = new ArrayList<>();
		mListViewMake.addHeaderView(mHeadView);
		mListViewMake.addFooterView(mFooterView);
		mArticleAdapter = new AdapterMyArticle(getActivity(), mArticleList, 25);
		mListViewMake.setAdapter(mArticleAdapter);
	}

	// 请求数据
	public void request() {
		Map<String, Object> map = new HashMap<String, Object>();
		JSONObject params = new JSONObject();
		try {
			params.put("DeviceID", Setting.DEVICEID);
			params.put("ApplicationID", Setting.APPLICATIONID);

			if (LoginUtil.checkIsLogin()) {
				params.put("UserID", LoginUtil.getUserId());
				params.put("LoginToken", LoginUtil.getLoginToken());
			} else {
				params.put("UserID", -1);
				params.put("LoginToken", "");
			}

			params.put("ClientVersion", AppManager.getVersionCode(
					getActivity(), getActivity().getPackageName()));
			params.put("BranchID", Setting.getBranchID(getActivity()));

		} catch (Exception e) {
		}
		map.put("ht", params);

		String url = Setting.getIndexDataUrl();

		ApiClient.http_post(url, map, null, this, REQUEST_DATA, true, false,
				true);
	}

	// 请求是否有新数据
	public void requesNews() {
		Map<String, Object> map = new HashMap<String, Object>();
		JSONObject params = new JSONObject();
		try {
			params.put("DeviceID", Setting.DEVICEID);
			params.put("ApplicationID", Setting.APPLICATIONID);
			params.put("ACIDList", "19|20|21|22|23|24|25");

			String dateString = AppConfig.getConfigString(getActivity(), Const.CONFIG_NEW_DATA_TIME,
					"");
			if(TextUtils.isEmpty(dateString))
			{
				dateString = DateUtilBase.stringFromDate(new Date(), DateUtilBase.DATE_ALL_ALL);
				AppConfig.setConfig(getActivity(), Const.CONFIG_NEW_DATA_TIME,
						dateString);
			}
			params.put("AfterTime", dateString);

		} catch (Exception e) {
		}
		map.put("ht", params);

		String url = Setting.getNewDataCountUrl();
		ApiClient.http_post(url, map, null, this, REQUEST_POINT, true, false);
	}

	private View.OnClickListener mOnClickListener = new View.OnClickListener() {

		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.index_help_consult_layout: // 快速咨询

				UmengHelper.CustomEvent(getActivity(),UmengEvent.event_wode_yijianfankui);

				MainTabActivity.getInstance().startActivity(new Intent(getActivity(), IndexConsultActivity.class),true);
				break;
			case R.id.index_help_file_layout: // 健康档案

				UmengHelper.CustomEvent(getActivity(),UmengEvent.event_jiankangdangan);

				boolean flag = LoginUtil.jumpLogin(MainTabActivity
						.getInstance());
				if (flag) {
					return;
				}

				MainTabActivity.getInstance().startActivity(new Intent(getActivity(), IndexFileActivity.class),true);
				break;
			case R.id.index_help_remind_layout: // 用药提醒

				UmengHelper.CustomEvent(getActivity(),UmengEvent.event_yongyaotixing);

				MainTabActivity.getInstance().startActivity(new Intent(getActivity(), IndexRemindActivity.class),true);
				break;
			case R.id.index_make_video_layout: // 视频集萃

				UmengHelper.CustomEvent(getActivity(),UmengEvent.event_shipinjicui);

				//MainTabActivity.getInstance().startActivity(new Intent(getActivity(), MyVideoActivity.class), true);
				MainTabActivity.getInstance().startActivity(new Intent(getActivity(), IndexVideoActivity.class), true);
				mVideoPoint.setVisibility(View.GONE);
				UserConfig.setConfig(getActivity(), Const.CONFIG_VIDEO_COUNT, 0);
				break;
			case R.id.index_make_know_layout: // 术后天天知

				UmengHelper.CustomEvent(getActivity(),UmengEvent.event_shuhoutiantianzhi);

				MainTabActivity.getInstance().startActivity(new Intent(getActivity(), IndexKnowActivity.class),true);
				break;
			case R.id.index_make_baike_layout: // 同心百科

				Intent baikeIntent = new Intent(getActivity(),IndexBaikeActivity.class);
				Bundle bundle = new Bundle();
				bundle.putSerializable("indexNew", mBeanIndexNew);
				baikeIntent.putExtras(bundle);
				MainTabActivity.getInstance().startActivity(baikeIntent,true);
				mBaikePoint.setVisibility(View.GONE);
				BeanIndexNew.cleanBaikeConfigCount(getActivity());
				break;
			case R.id.index_make_book_layout: // 同心书坊

				UmengHelper.CustomEvent(getActivity(),UmengEvent.event_tongxinshufang);

				MainTabActivity.getInstance().startActivity(new Intent(getActivity(), IndexBookActivity.class),true);
				break;
			case R.id.index_help_list_more: // 全部问题
				UmengHelper.CustomEvent(getActivity(),UmengEvent.event_quanbuwenti);

				MainTabActivity.getInstance().startActivity(new Intent(getActivity(), MyConsultActivity.class),true);
				UmengHelper.CustomEvent(getActivity(), UmengEvent.event_changjianwenti_search);
				break;
			case R.id.index_make_list_more: // 更多内容
				UmengHelper.CustomEvent(getActivity(),UmengEvent.event_gengduojingcaineirong);

				Intent makeMoreIntent = new Intent(getActivity(),IndexBaikeActivity.class);
				MainTabActivity.getInstance().startActivity(makeMoreIntent,true);
				break;
			case R.id.index_mall_layout: // 更多商城
				UmengHelper.CustomEvent(getActivity(),UmengEvent.event_jiankangshangcheng);

				MyStoreUtil.getInstance().requestAllMarket(MainTabActivity.getInstance(), "");
				break;

			default:
				break;
			}
		}
	};

	@SuppressWarnings("deprecation")
	private void dowithShopBanner(ArrayList<BeanFocus> focusMallList) {
		
		mMallLayout.removeAllViews();
		// 商场比例
		WindowManager wm = (WindowManager) getActivity().getSystemService(
				Context.WINDOW_SERVICE);
		int width = wm.getDefaultDisplay().getWidth();
		LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,
				LayoutParams.WRAP_CONTENT);
		params.width = width;
		params.height = width * 8 / 25;
		mMallLayout.setLayoutParams(params);

		mFocusViewMall = new FocusView(getActivity(), focusMallList,FocusView.TYPE_STORE,mRefreshLayout);
		mMallLayout.addView(mFocusViewMall);
	}

	@SuppressLint("HandlerLeak")
	public Handler mHandler = new Handler() {
		public void handleMessage(Message msg) {
			switch (msg.what) {
			case MSG_DATA_SUCCESS:

				if(getActivity() == null)
				{
					return;
				}

				mHandler.postDelayed(new Runnable() {

					@Override
					public void run() {
						mRefreshLayout.setRefreshing(false);
					}
				}, 100);
				
				mInitDataSuccess = true;
				BeanIndex beanIndex = (BeanIndex) msg.obj;

				int hasSign = UtilityBase.parseInt(beanIndex.HasSignIn);
				if(hasSign == 1)
				{
					MainTabActivity.getInstance().updateSignInState(false);
				}else{
					MainTabActivity.getInstance().updateSignInState(true);
				}

				// 轮播图
				ArrayList<BeanFocus> focusList = new ArrayList<BeanFocus>();
				focusList.addAll(beanIndex.BannerList);
				
				if(focusList != null && focusList.size() > 0)
				{
					mFocusLayout.removeAllViews();
					mFocusViewTop = new FocusView(getActivity(), focusList,FocusView.TYPE_INDEX_TOP,mRefreshLayout);
					mFocusLayout.addView(mFocusViewTop);
				}

				// 帮手
				mQuestionList = beanIndex.QuestionAnswerList;
				mQuestionAdapter = new AdapterQuestionList(
						getActivity(), mQuestionList, true);
				mListViewHelp.setAdapter(mQuestionAdapter);

				// 商场
				ArrayList<BeanFocus> focusMallList = beanIndex.ShopBannerList;
				dowithShopBanner(focusMallList);
				
				// 精选
				if(mHeadView != null){
					mListViewMake.removeHeaderView(mHeadView);
				}
				
				mArticleList = beanIndex.GoodArticleList;
				mListViewMake.addHeaderView(mHeadView);
				mArticleAdapter = new AdapterMyArticle(getActivity(), mArticleList, 25);
				mListViewMake.setAdapter(mArticleAdapter);
				
				break;
			case MSG_DATA_FAIL:

				if(getActivity() == null)
				{
					return;
				}

				mHandler.postDelayed(new Runnable() {

					@Override
					public void run() {
						mRefreshLayout.setRefreshing(false);
					}
				}, 100);
				
				break;
			case MSG_POINT_SUCCESS:
				mBeanIndexNew = (BeanIndexNew) msg.obj;

				if(getActivity() == null)
				{
					return;
				}
				
				//视频点
				if(BeanIndexNew.checkVideo(mBeanIndexNew)){
					AppConfig.setConfig(getActivity(), Const.CONFIG_NEW_DATA_TIME, mBeanIndexNew.time);
					
					mVideoPoint.setVisibility(View.VISIBLE);
					UserConfig.setConfig(getActivity(), Const.CONFIG_VIDEO_COUNT, mBeanIndexNew.video);
				}else{
					mBeanIndexNew.video = UserConfig.getConfigInt(getActivity(), Const.CONFIG_VIDEO_COUNT,0);
					
					if(BeanIndexNew.checkVideo(mBeanIndexNew)){
						mVideoPoint.setVisibility(View.VISIBLE);
					}else{
						mVideoPoint.setVisibility(View.GONE);
					}
				}
				
				//百科点
				if(BeanIndexNew.checkBaike(mBeanIndexNew)){
					AppConfig.setConfig(getActivity(), Const.CONFIG_NEW_DATA_TIME, mBeanIndexNew.time);
					
					mBaikePoint.setVisibility(View.VISIBLE);
					BeanIndexNew.setBaikeConfigCount(getActivity(),mBeanIndexNew);
					
				}else{
					mBeanIndexNew.good = UserConfig.getConfigInt(getActivity(), Const.CONFIG_GOOD_COUNT,0);
					mBeanIndexNew.drug = UserConfig.getConfigInt(getActivity(), Const.CONFIG_DRUG_COUNT,0);
					mBeanIndexNew.food = UserConfig.getConfigInt(getActivity(), Const.CONFIG_FOOD_COUNT,0);
					mBeanIndexNew.sport = UserConfig.getConfigInt(getActivity(), Const.CONFIG_SPORT_COUNT,0);
					mBeanIndexNew.heart = UserConfig.getConfigInt(getActivity(), Const.CONFIG_HEART_COUNT,0);
					mBeanIndexNew.life = UserConfig.getConfigInt(getActivity(), Const.CONFIG_LIFE_COUNT,0);
					
					if(BeanIndexNew.checkBaike(mBeanIndexNew)){
						mBaikePoint.setVisibility(View.VISIBLE);
					}else{
						mBaikePoint.setVisibility(View.GONE);
					}
				}
				break;
			case MSG_POINT_FAIL:

				break;
			default:
				break;
			}
		};
	};

	@Override
	public void RequestComplete(Object object, Object data) {
		if (object.equals(REQUEST_DATA)) {
			BeanIndex dataArraylist = BeanIndex.parseJsonData((String) data);

			Message msg = mHandler.obtainMessage();
			msg.what = MSG_DATA_SUCCESS;
			msg.obj = dataArraylist;
			mHandler.sendMessage(msg);
			
		} else if (object.equals(REQUEST_POINT)) {
			BeanIndexNew beanIndexNew = BeanIndexNew
				.parseJsonData((String) data);

			Message msg = mHandler.obtainMessage();
			msg.what = MSG_POINT_SUCCESS;
			msg.obj = beanIndexNew;
			mHandler.sendMessage(msg);
		}
	}

	@Override
	public void RequestError(Object object, int errorId, String errorMessage) {
		if (object.equals(REQUEST_DATA)) {
			Message msg = mHandler.obtainMessage();
			msg.what = MSG_DATA_FAIL;
			mHandler.sendMessage(msg);
		}else {
			Message msg = mHandler.obtainMessage();
			msg.what = MSG_POINT_SUCCESS;
			msg.obj = new BeanIndexNew();
			mHandler.sendMessage(msg);
		}
	}

	private void showHideChatCircle() {

		int totalCount = 0;

//		ChatSession chatSessionStaff = ChatManager.getInstance()
//				.getChatStaffSession(Constants.Staff);
//		if (chatSessionStaff != null) {
//			totalCount = chatSessionStaff.getNewMsgCount();
//		}
		int count = LoginUtil.getStaffMsgNewCount();
		totalCount += count;

		List<ChatSession> sessions = ChatManager.getInstance()
				.getChatSessions();
		if (sessions != null && sessions.size() > 0) {
			for (ChatSession item : sessions) {
				totalCount += item.getNewMsgCount();
			}
		} 
		
		if (totalCount > 0) {
			indexChatCircleImageView.setVisibility(View.VISIBLE);
		} else {
			indexChatCircleImageView.setVisibility(View.GONE);
		}
	}
	
	
	/**
	 * main thread
	 */
	@Override
	public void notify(String name, Object sender, Object data) {

		if (name.equals(ObserverConst.NOTIFY_CHAT_INDEX_CIRCLE)) {
			// 快速咨询红点
			showHideChatCircle();
		}else if(name.equals(ObserverConst.NOTIFY_INDEX_UPDATE_QUESTION)){
			//不更新数量
//			Integer position = (Integer) sender;
//			BeanQuestionAnswer beanQuestionAnswer = (BeanQuestionAnswer) data;
//
//			if(mQuestionList != null && mQuestionList.size() > 0)
//			{
//				if(position < mQuestionList.size())
//				{
//					BeanQuestionAnswer temp = mQuestionList.get(position);
//					if(beanQuestionAnswer.ARQAID.equals(temp.ARQAID))
//					{
//						mQuestionList.get(position).FavourCount = beanQuestionAnswer.FavourCount;
//						mQuestionList.get(position).ViewCount = beanQuestionAnswer.ViewCount;
//
//						mQuestionAdapter.notifyDataSetChanged();
//					}
//				}
//			}

		}else if(name.equals(ObserverConst.NOTIFY_INDEX_UPDATE_ARTICLE)){
//			Integer position = (Integer) sender;
//			BeanMyArticle beanMyArticle = (BeanMyArticle) data;
//
//			if(mArticleList != null && mArticleList.size() > 0)
//			{
//				if(position < mArticleList.size())
//				{
//					BeanMyArticle temp = mArticleList.get(position);
//					if(beanMyArticle.ArticleID.equals(temp.LinkTargetID))
//					{
//						mArticleList.get(position).FavourCount = beanMyArticle.FavourCount;
//						mArticleList.get(position).ViewCount = beanMyArticle.ViewCount;
//						mArticleList.get(position).CollectCount = beanMyArticle.CollectCount;
//
//						mArticleAdapter.notifyDataSetChanged();
//					}
//				}
//			}
		}
	}

	@Override
	public void onRefresh() {
		request();
	}
}
